<?php
// +----------------------------------------------------------------------
// | Iecms [ Make the most exquisite CMS ]
// +----------------------------------------------------------------------
// | Copyright (c) 2009~2019 http://www.iemoo.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: iemoo <i@iemoo.com>
// +----------------------------------------------------------------------
// | DateTime: 2019/11/19 11:08
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

/**
 * 会员验证器
 * @package app\admin\validate
 */
class Member extends Validate
{
    protected $rule = [
        'username'			=> 'require|alphaNum|unique:member',
		'nickname'			=> 'require|chsAlphaNum|unique:member',
        'password'			=> 'require',
        'status'			=> 'require|number',
        'member_group_id'	=> 'require|number|gt:0'
    ];

    protected $message = [
        'username.require'			=> '请输入用户名',
		'username.alphaNum'			=> '用户名只能是字母和数字',
        'username.unique'			=> '用户名已存在',
		'nickname.require'			=> '请输入昵称',
		'nickname.alphaNum'			=> '昵称只能是汉字、字母和数字',
        'nickname.unique'			=> '昵称已存在',
		'password.require'			=> '请输入密码',
        'status.require'			=> '请选择状态',
		'status.number'				=> '状态不正确',
        'member_group_id.require'	=> '请选择所属权限组',
		'member_group_id.number'	=> '所属权限组不正确',
		'member_group_id.gt'		=> '请选择权限组'
    ];
	
	protected $scene = [
        'edit'  =>  ['username','nickname','status','member_group_id'],
    ];   

}